﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ThucThe;
using System.Data;
namespace KetNoi
{
    public class Ve_ketnoi
    {
        clsKetNoi kn = new clsKetNoi();
        public DataTable danhSachVe()
        {
            return kn.LayDuLieu("Ve_load");
        }
         public int Them_Ve(Ve_thucthe ve)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@tenVe"; value[0] = ve.MaHopDong;
            
            return kn.CapNhat("Ve_them", name, value, Nparameter);
        }
        public int Sua_Ve(Ve_thucthe ve)
        {
            int Nparameter = 2;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@maVe"; value[0] = ve.MaVe;
            name[1] = "@tenVe"; value[1] = ve.MaHopDong;
            return kn.CapNhat("Ve_sua", name, value, Nparameter);
        }
        public int Xoa_Ve(Ve_thucthe ve)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@maVe";
            value[0] = ve.MaVe;
            return kn.CapNhat("Ve_xoa", name, value, Nparameter);
        }
        public DataTable Tim_Ve(KhachHang_thucthe kh)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@tenKhachHang";
            value[0] = kh.TenKhachHang;
            return kn.TimKiem("Ve_tim", name, value, Nparameter);
        }
    }
}
